package com.android.lovely.data

import com.android.lovely.R

/**
 * 定义交易类型的映射，包含类型 ID 和内容资源
 */
// 重命名映射变量
 val tradeTypeMap = mapOf(
    -1 to TradeType.TransactionDefault,
    null to TradeType.TransactionAll,
    1 to TradeType.TransactionSign,
    2 to TradeType.TransactionRecharge,
    3 to TradeType.TransactionChat,
    4 to TradeType.TransactionVipDailyGet,
    5 to TradeType.TransactionVipRechargeGet,
    6 to TradeType.TransactionBuyCard,
    7 to TradeType.TransactionUnsubscribe,
    8 to TradeType.TransactionSignInAd,
    9 to TradeType.TransactionInAppAd,
    10 to TradeType.TransactionWalletAd,
    11 to TradeType.TransactionChatAd,
    12 to TradeType.TransactionShare,
    13 to TradeType.TransactionPlatformGive,
    14 to TradeType.TransactionCreateRole,
    15 to TradeType.TransactionModifyRole,
    16 to TradeType.TransactionGenImage,
    17 to TradeType.TransactionRestoreGenImage,
    18 to TradeType.TransactionReview,
    19 to TradeType.TransactionInvite,
    20 to TradeType.TransactionInviteGet,
    21 to TradeType.TransactionSmartGenerate
)

// 重命名类
sealed class TradeType(val typeId: Int?, val contentResId: Int) {
    data object TransactionDefault : TradeType(-1, R.string.unknown)
    data object TransactionAll : TradeType(null, R.string.all)
    data object TransactionSign : TradeType(1, R.string.transaction_check_in)
    data object TransactionRecharge : TradeType(2, R.string.transaction_recharge)
    data object TransactionChat : TradeType(3, R.string.chat)
    data object TransactionVipDailyGet : TradeType(4, R.string.transaction_vip_daily)
    data object TransactionVipRechargeGet : TradeType(5, R.string.transaction_buy_vip)
    data object TransactionBuyCard : TradeType(6, R.string.transaction_buy_image)
    data object TransactionUnsubscribe : TradeType(7, R.string.transaction_unsubscribe)
    data object TransactionSignInAd : TradeType(8, R.string.transaction_sign_in_ad)
    data object TransactionInAppAd : TradeType(9, R.string.transaction_in_app_ad)
    data object TransactionWalletAd : TradeType(10, R.string.transaction_wallet_ad)
    data object TransactionChatAd : TradeType(11, R.string.transaction_chat_ad)
    data object TransactionShare : TradeType(12, R.string.transaction_share)
    data object TransactionPlatformGive : TradeType(13, R.string.transaction_platform_give)
    data object TransactionCreateRole : TradeType(14, R.string.transaction_create_character)
    data object TransactionModifyRole : TradeType(15, R.string.transaction_update_character)
    data object TransactionGenImage : TradeType(16, R.string.transaction_gen_image)
    data object TransactionRestoreGenImage : TradeType(17, R.string.transaction_restore_gen_image)
    data object TransactionReview : TradeType(18, R.string.transaction_review)
    data object TransactionInvite : TradeType(19, R.string.transaction_invite)
    data object TransactionInviteGet : TradeType(20, R.string.transaction_invite_relationship)
    data object TransactionSmartGenerate : TradeType(21, R.string.transaction_ai_create_character)

    companion object {
        /**
         * 获取所有交易类型的列表
         */
        fun getAll(): List<TradeType> {
            return tradeTypeMap.values.toList()
        }

        /**
         * 根据类型 ID 获取对应的交易类型
         */
        fun getTypeById(typeId: Int?): TradeType {
            return tradeTypeMap[typeId] ?: TransactionDefault
        }
    }
}